import http from './index.js'

// 搜索现有的模型
export const getModel = data => {
  return http({
    method: 'get',
    url: 'list_model',
    params: data
  })
}

// 删除现有的模型
export const delModel = data => {
  return http({
    method: 'get',
    url: 'remove_container',
    params: data
  })
}

// 现有的模型改名
export const nameModel = data => {
  return http({
    method: 'get',
    url: 'remove_model',
    params: data
  })
}

//开始部署
export const beginDeploy = data => {
  return http({
    method: 'post',
    url: '/build_start_container',
    data: data
  })
}

//停止容器
export const stopDeploy = data => {
  return http({
    method: 'get',
    url: 'stop_container',
    params: data
  })
}

//删除容器
export const delDeploy = data => {
  return http({
    method: 'get',
    url: 'remove_container',
    params: data
  })
}

//正在运行的容器和状态
export const listDeploy = data => {
  return http({
    method: 'get',
    url: 'list_container',
    params: data
    // withCredentials: true
  })
}

// 查看所有的容器的运行状态
export const allContainer = data => {
  return http({
    method: 'get',
    url: 'list_all_container_status',
    params: data
  })
}

//训练
export const beginDrill = data => {
  return http({
    method: 'post',
    url: 'build_train_container',
    data: data
  })
}

//获取训练日志
export const logDrill = data => {
  return http({
    method: 'websocket',
    url: 'train_logs',
    data: data
  })
}
